#include "circlenode.h"
#include "mainwindow.h"
#include "scene.h"
#include "ui_mainwindow.h"

#include <QGraphicsScene>
#include <QGraphicsView>
#include <QPen>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    m_scene = new Scene;
    m_scene->setSceneRect(0, 0, 800, 600);
    m_scene->setBackgroundBrush(QBrush(Qt::gray));

    m_view = new QGraphicsView(this->centralWidget());
    m_view->setGeometry(0, 0, 802, 602);
    m_view->setScene(m_scene);

//    m_scene->setData(QList<int>{33, 55, 2, 9, 6, 88, 63, 27, 11, 34, 22});


}

MainWindow::~MainWindow()
{
    if (nullptr == m_view) delete m_view;
    if (nullptr == m_scene) delete m_scene;
    if (nullptr == ui) delete ui;
}

Scene *MainWindow::scene()
{
    return m_scene;
}


void MainWindow::on_pushButton_clicked()
{
    m_scene->swap(1, 7);
}

